﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MISAPP.MISInterface;
using MISAPP.Classify.Service;


public partial class View_MIS_AC001_Query : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        hdn_return.Value = Request.QueryString["hdn"].ToString();

//        string js = @"function Button1_onclick(AgrNo)
//         {            
//	        object hdn = document.getElementById('Text1');
//	        alert(hdn.value);
//         }";
//        js = js.Replace("Text1", hdn_return.ClientID);
//        ScriptManager.RegisterClientScriptBlock(this, this.GetType()
//        , string.Format("Return_{0}",hdn_return.ClientID) , js, true);

    }

    protected void btnQuery_Click(object sender, EventArgs e)
    {
        getData();
    }

    protected void getData()
    {
        Service_ARTM95_ABCDE abcde = new Service_ARTM95_ABCDE();
        System.Data.DataTable dt = abcde.GetAccInfo2(txtAccNo.Text, txtAccName.Text);
        gv1.DataSource = dt;
        gv1.DataBind();
    }

    protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Button btn = e.Row.Cells[0].FindControl("btnSel") 
                as Button;
            if (btn != null)
            {
                string txt = string.Format("'{0}','{1}'",
                    e.Row.Cells[1].Text.Trim()
                    ,e.Row.Cells[2].Text.Trim());
                btn.OnClientClick =string.Format("return Button1_onclick({0})"
                    ,txt);
            }
        }
    }

    protected void gv1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gv1.PageIndex = e.NewPageIndex;
        getData();
    }
}
